/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 *
 * @author USUARIO
 */
@Entity
@Table(name = "tarjeta")
@NamedQueries({
    @NamedQuery(name = "Tarjeta.findAll", query = "SELECT t FROM Tarjeta t")})
public class Tarjeta implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "nro_transaccion")
    private Integer nroTransaccion;
    @Basic(optional = false)
    @Column(name = "nro_tarjeta")
    private String nroTarjeta;
    @Basic(optional = false)
    @Column(name = "propietario")
    private String propietario;
    @JoinColumn(name = "firma", referencedColumnName = "id_firma")
    @ManyToOne
    private Firma firma;
    @JoinColumn(name = "tipo", referencedColumnName = "id_tipo")
    @ManyToOne
    private TipoTarjeta tipo;
    @JoinColumn(name = "banco", referencedColumnName = "id_banco")
    @ManyToOne
    private Banco banco;
    @JoinColumn(name = "nro_transaccion", referencedColumnName = "nro_transaccion", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Pago pago;

    public Tarjeta() {
    }

    public Tarjeta(Integer nroTransaccion) {
        this.nroTransaccion = nroTransaccion;
    }

    public Tarjeta(Integer nroTransaccion, String nroTarjeta, String propietario) {
        this.nroTransaccion = nroTransaccion;
        this.nroTarjeta = nroTarjeta;
        this.propietario = propietario;
    }

    public Integer getNroTransaccion() {
        return nroTransaccion;
    }

    public void setNroTransaccion(Integer nroTransaccion) {
        this.nroTransaccion = nroTransaccion;
    }

    public String getNroTarjeta() {
        return nroTarjeta;
    }

    public void setNroTarjeta(String nroTarjeta) {
        this.nroTarjeta = nroTarjeta;
    }

    public String getPropietario() {
        return propietario;
    }

    public void setPropietario(String propietario) {
        this.propietario = propietario;
    }

    public Firma getFirma() {
        return firma;
    }

    public void setFirma(Firma firma) {
        this.firma = firma;
    }

    public TipoTarjeta getTipo() {
        return tipo;
    }

    public void setTipo(TipoTarjeta tipo) {
        this.tipo = tipo;
    }

    public Banco getBanco() {
        return banco;
    }

    public void setBanco(Banco banco) {
        this.banco = banco;
    }

    public Pago getPago() {
        return pago;
    }

    public void setPago(Pago pago) {
        this.pago = pago;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nroTransaccion != null ? nroTransaccion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tarjeta)) {
            return false;
        }
        Tarjeta other = (Tarjeta) object;
        if ((this.nroTransaccion == null && other.nroTransaccion != null) || (this.nroTransaccion != null && !this.nroTransaccion.equals(other.nroTransaccion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Tarjeta[ nroTransaccion=" + nroTransaccion + " ]";
    }
    
}
